import request from '@/router/axios';

export const getCity = (params) => {
  let query = '?key=56f8451d47b1492066b2d7705472df88'
  for (let name in params) {
    query += '&'+ name + '=' + params[name];
  }
  return request({
    url: 'https://restapi.amap.com/v3/config/district' + query,
    method: 'get',
    params: {

    },
    meta: {
      isToken: false,
    }
  })
};

export const getDeviceCount = (params) => {
  return request({
    url: '/api/blade-lamp/api/device/getDeviceCountByProvince',
    method: 'get',
    params: {
      ...params,
    }
  })
};

export const getDeviceList = (current, size, params) => {
  return request({
    url: '/api/blade-lamp/api/device/getDevicePageByArea',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
};

export const getAreaTree = (params) => {
  return request({
    url: '/api/blade-lamp/area/tree',
    method: 'get',
    params: {
      ...params,
    }
  })
};

export const getStrategy = (params) => {
  return request({
    url: '/api/blade-lamp/workstrategy/page',
    method: 'get',
    params: {
      ...params,
    }
  })
};

export const iotAction = (url, method, params) => {
  let prefix = '/api/blade-iot/iot/';
  return request({
    url: prefix + url,
    method: method,
    params: {
      ...params,
    }
  })
};

